package com.example.volunteer.mapper;


import com.example.volunteer.model.Points;
import com.example.volunteer.util.PageResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;


import java.util.List;
@Mapper
public interface PointsMapper {
    void insert(Points points);
    void update(Points points);
    Points findByVolunteerAndActivity(
            @Param("volunteerId") String volunteerId,
            @Param("activityId") Integer activityId
    );

    void delete(@Param("pointsId") int pointsId);

    List<Points> findPointsWithPage(@Param("offset") int offset, @Param("pageSize") int pageSize);
    int countPoints();

    List<Points> findByVolunteerIdWithPage(@Param("volunteerId") String volunteerId, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByVolunteerId(@Param("volunteerId") String volunteerId);

    List<Points> findByActivityIdWithPage(@Param("activityId") Integer activityId, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByActivityId(@Param("activityId") Integer activityId);

    List<Points> findByPointsIdWithPage(@Param("pointsId") Integer pointsId, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByPeriodId(@Param("pointsId") Integer pointsId);

    List<Points> findByPointsEarnWithPage(@Param("pointsEarned") int pointsEarned, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countByPointsEarn(@Param("pointsEarned") int pointsEarned);

    List<Points> findTop10VolunteersWithPage(@Param("offset") int offset, @Param("pageSize") int pageSize);
    int countTop10Volunteers();

    List<Points> findTop10VolunteersByPeriodWithPage(@Param("months") int months, @Param("offset") int offset, @Param("pageSize") int pageSize);
    int countTop10VolunteersByPeriod(@Param("months") int months);

}
